home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ddevb / dde_vb.frm < prev    next >
Text File  |  1995-09-06  |  21KB  |  748 lines

  1. VERSION 2.00
  2. Begin Form DDE_VB 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "DDE_VB"
  6.    ClientHeight    =   4950
  7.    ClientLeft      =   1020
  8.    ClientTop       =   2520
  9.    ClientWidth     =   7575
  10.    Height          =   5640
  11.    Icon            =   DDE_VB.FRX:0000
  12.    Left            =   960
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   4950
  17.    ScaleWidth      =   7575
  18.    Top             =   1890
  19.    Width           =   7695
  20.    Begin TextBox tbStatus 
  21.       FontBold        =   -1  'True
  22.       FontItalic      =   -1  'True
  23.       FontName        =   "MS Sans Serif"
  24.       FontSize        =   8.25
  25.       FontStrikethru  =   0   'False
  26.       FontUnderline   =   0   'False
  27.       Height          =   360
  28.       Left            =   0
  29.       TabIndex        =   14
  30.       Top             =   4608
  31.       Width           =   7596
  32.    End
  33.    Begin CommandButton cmClipboard 
  34.       Caption         =   "Clipboard"
  35.       Height          =   276
  36.       Left            =   6240
  37.       TabIndex        =   17
  38.       Top             =   4128
  39.       Width           =   1236
  40.    End
  41.    Begin TextBox tbDDE 
  42.       Height          =   372
  43.       Left            =   6240
  44.       MultiLine       =   -1  'True
  45.       TabIndex        =   12
  46.       Top             =   2208
  47.       Visible         =   0   'False
  48.       Width           =   1236
  49.    End
  50.    Begin TextBox tbText 
  51.       Height          =   2220
  52.       Left            =   96
  53.       MultiLine       =   -1  'True
  54.       ScrollBars      =   2  'Vertical
  55.       TabIndex        =   13
  56.       Top             =   2208
  57.       Width           =   6036
  58.    End
  59.    Begin CommandButton cmPoke 
  60.       Caption         =   "Poke"
  61.       Height          =   276
  62.       Left            =   6240
  63.       TabIndex        =   16
  64.       Top             =   1728
  65.       Width           =   1236
  66.    End
  67.    Begin ComboBox cbPoke 
  68.       Height          =   288
  69.       Left            =   96
  70.       TabIndex        =   15
  71.       Top             =   1728
  72.       Width           =   6036
  73.    End
  74.    Begin CommandButton cmExecute 
  75.       Caption         =   "Execute"
  76.       Enabled         =   0   'False
  77.       Height          =   276
  78.       Left            =   6240
  79.       TabIndex        =   9
  80.       Top             =   1344
  81.       Width           =   1236
  82.    End
  83.    Begin ComboBox cbExecute 
  84.       Enabled         =   0   'False
  85.       Height          =   288
  86.       Left            =   96
  87.       TabIndex        =   3
  88.       Top             =   1344
  89.       Width           =   6036
  90.    End
  91.    Begin CommandButton cmDisconnect 
  92.       Caption         =   "Disconnect"
  93.       Height          =   276
  94.       Left            =   6240
  95.       TabIndex        =   5
  96.       Top             =   864
  97.       Visible         =   0   'False
  98.       Width           =   1236
  99.    End
  100.    Begin TextBox tbError 
  101.       ForeColor       =   &H00000080&
  102.       Height          =   300
  103.       Left            =   100
  104.       TabIndex        =   11
  105.       Top             =   888
  106.       Width           =   5676
  107.    End
  108.    Begin CommandButton cmRequest 
  109.       Caption         =   "Request"
  110.       Enabled         =   0   'False
  111.       Height          =   276
  112.       Left            =   6240
  113.       TabIndex        =   10
  114.       Top             =   576
  115.       Width           =   1236
  116.    End
  117.    Begin ComboBox cbDDE_Item 
  118.       BackColor       =   &H00FFFFFF&
  119.       Enabled         =   0   'False
  120.       Height          =   288
  121.       Left            =   3600
  122.       TabIndex        =   2
  123.       Top             =   600
  124.       Width           =   2556
  125.    End
  126.    Begin ComboBox cbDDE_Topic 
  127.       BackColor       =   &H00FFFFFF&
  128.       Enabled         =   0   'False
  129.       Height          =   288
  130.       Left            =   1920
  131.       TabIndex        =   1
  132.       Top             =   600
  133.       Width           =   1572
  134.    End
  135.    Begin ComboBox cbDDE_App 
  136.       BackColor       =   &H00FFFFFF&
  137.       Height          =   288
  138.       Left            =   100
  139.       TabIndex        =   0
  140.       Top             =   600
  141.       Width           =   1692
  142.    End
  143.    Begin CommandButton cmQuit 
  144.       Caption         =   "Quit"
  145.       Height          =   276
  146.       Left            =   6240
  147.       TabIndex        =   4
  148.       Top             =   96
  149.       Width           =   1236
  150.    End
  151.    Begin Label txItem 
  152.       BackColor       =   &H00FFFFFF&
  153.       Caption         =   "Item"
  154.       Height          =   255
  155.       Left            =   3600
  156.       TabIndex        =   8
  157.       Top             =   360
  158.       Width           =   1095
  159.    End
  160.    Begin Label txTopic 
  161.       BackColor       =   &H00FFFFFF&
  162.       Caption         =   "Topic"
  163.       Height          =   255
  164.       Left            =   1920
  165.       TabIndex        =   7
  166.       Top             =   360
  167.       Width           =   1095
  168.    End
  169.    Begin Label txApplication 
  170.       BackColor       =   &H00FFFFFF&
  171.       Caption         =   "Application"
  172.       Height          =   255
  173.       Left            =   100
  174.       TabIndex        =   6
  175.       Top             =   360
  176.       Width           =   1335
  177.    End
  178.    Begin Menu mnFile 
  179.       Caption         =   "&File"
  180.       Begin Menu miFileEdit 
  181.          Caption         =   "&Edit INI File"
  182.       End
  183.       Begin Menu miFileExit 
  184.          Caption         =   "E&xit"
  185.       End
  186.    End
  187.    Begin Menu mnSave 
  188.       Caption         =   "&Save"
  189.       Index           =   0
  190.       Begin Menu miSaveApp 
  191.          Caption         =   "&Application"
  192.       End
  193.       Begin Menu miSaveTopic 
  194.          Caption         =   "&Topic"
  195.       End
  196.       Begin Menu miSaveItem 
  197.          Caption         =   "&Item"
  198.       End
  199.       Begin Menu miBar1 
  200.          Caption         =   "-"
  201.       End
  202.       Begin Menu miSaveExecute 
  203.          Caption         =   "&Execute"
  204.       End
  205.       Begin Menu miBar2 
  206.          Caption         =   "-"
  207.       End
  208.       Begin Menu miSavePoke 
  209.          Caption         =   "&Poke"
  210.       End
  211.    End
  212.    Begin Menu mnHelp 
  213.       Caption         =   "&Help"
  214.       Begin Menu miHelpAbout 
  215.          Caption         =   "&About"
  216.       End
  217.    End
  218. End
  219. DefInt A-X
  220. Const NO_APP = 282
  221. Const MULTIPLE_APPS = 283
  222. Const WRONG_DATA_TYPE = 285
  223.  
  224. Const WM_USER = &H400
  225. Const LB_RESETCONTENT = WM_USER + 5
  226. Const CB_RESETCONTENT = WM_USER + 11
  227.  
  228. Dim DDEApp As String
  229. Dim DDETopic As String
  230. Dim DDEItem As String
  231. Dim ValidLink As Integer
  232.  
  233. Dim app As String * 100
  234. Dim exec As String * 200
  235. Dim item As String * 100
  236. Dim Topic As String * 100
  237. Dim clipname As String * 40
  238.  
  239. Const INIFILE$ = "DDE_VB.INI"
  240. Const INI_APPS$ = "Applications"
  241.  
  242. Dim HelpFilePath$
  243. Dim CR$
  244. Dim LF$
  245. Dim NL$
  246. Dim TB$
  247.  
  248. Sub cbDDE_App_Change ()
  249.     cbDDE_Topic.Enabled = True
  250.     cbDDE_Topic.text = ""
  251.     cbDDE_Item.Enabled = False
  252.     cbDDE_Item.text = ""
  253.     cmDisconnect_click
  254. End Sub
  255.  
  256. Sub cbDDE_App_DropDown ()
  257.     
  258.     ClearComboBox cbDDE_App
  259.     
  260.     Count% = GetPrivateProfileInt("Applications", "Apps", 0, INIFILE$)
  261.     ReDim arIniApps(Count%)
  262.     For i% = 1 To Count%
  263.         zBuff% = GetPrivateProfileString("Applications", "App" + LTrim$(Str$(i%)), "none", app, 255, INIFILE$)
  264.         arIniApps(i% - 1).AppName = LTrim$(RTrim$(Left$(app, zBuff%)))
  265.         cbDDE_App.AddItem arIniApps(i% - 1).AppName
  266.     Next
  267.     
  268.     cbDDE_Topic.Enabled = True
  269.     cbDDE_Topic.text = ""
  270.     cbDDE_Item.Enabled = False
  271.     cbDDE_Item.text = ""
  272.  
  273. End Sub
  274.  
  275. Sub cbDDE_App_GotFocus ()
  276.     tbStatus.text = "Select / Enter Application name to connect to..."
  277. End Sub
  278.  
  279. Sub cbDDE_App_LostFocus ()
  280.     tbStatus.text = ""
  281. End Sub
  282.  
  283. Sub cbDDE_Item_DropDown ()
  284.  
  285.     ClearComboBox cbDDE_Item
  286.     
  287.     cmRequest.Enabled = True
  288.     Topic = cbDDE_Topic.text
  289.     
  290.     Count2% = GetPrivateProfileInt(app, "Items", 0, INIFILE$)
  291.     ReDim arItems(Count2%)
  292.     
  293.     For ii% = 1 To Count2%
  294.         zBuff% = GetPrivateProfileString(app, "Item" + LTrim$(Str$(ii%)), "none", item, 255, INIFILE$)
  295.         arItems(ii% - 1).item = LTrim$(RTrim$(Left$(item, z